def c_array_to_tflite(input_file, output_file):
    with open(input_file, 'r') as f:
        content = f.read()

    start_index = content.find('{') + 1
    end_index = content.find('}')
    data_str = content[start_index:end_index].strip()
    data_list = data_str.split(',')
    data_bytes = bytes(int(byte_str.strip(), 16) for byte_str in data_list if byte_str.strip())

    with open(output_file, 'wb') as f:
        f.write(data_bytes)


input_file = 'sine_model_quantized.cc'
output_file = 'sine_model_quantized_generated.tflite'
c_array_to_tflite(input_file, output_file)
